public class ConversationPresenter implements TIMMessageListener{
	
    private ConversationView view;

	//构函数绑定view
    public ConversationPresenter(ConversationView view){
        this.view = view;
    }
	
	//SDK新消息接口
	@Override
    public boolean onNewMessages(List<TIMMessage> list) {
        for (TIMMessage item:list){
            refresh(item);
        }
        return false;
    }
	
    //view去更新界面
    public void refresh(TIMMessage msg) {
        view.updateMessage(msg);
    }
	
	//SDK获取会话列表
    public void getConversation(){
        List<TIMConversation> list = TIMManagerExt.getInstance().getConversationList();
		//view去载入数据
        view.initView(list);
    }

    //删除会话
    public boolean delConversation(TIMConversationType type, String id){
        return TIMManagerExt.getInstance().deleteConversationAndLocalMsgs(type, id);
    }
}
